package com.woniu.order.feign;

import com.woniu.common.dto.*;
import com.woniu.common.entity.ZyProduct;
import com.woniu.common.utils.ResponseData;
import com.woniu.order.pojo.OrderDetail;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.w3c.dom.stylesheets.LinkStyle;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ltyipx
 * @version 1.0
 * @description:TODO
 * @date 2024/8/9 9:59
 */
@FeignClient(name = "product-server")
public interface ProductFeign {
    @GetMapping("/queryGoodsByIds")
    ResponseData<List<ForOrderProductDTO>> queryGoodsByIds(@RequestParam("ids") String[] ids);

    @GetMapping("/queryProductTypeById")
    ResponseData<ProductTypeDTO> queryProductTypeById(@RequestParam("id") Integer id);

    @PostMapping("/rollBackStock")
    void rollBackStock(@RequestBody List<OrderDetail> list);

    @GetMapping("/queryCouponById")
    ResponseData<CouponStatusDTO> queryCouponById(@RequestParam("id") String id);

    @GetMapping("/UseCoupon")
    void UseCoupon(@RequestParam("couponId") String couponId);
    @PostMapping("/selectProduct")
    List<ZyProduct> selectProduct(@RequestBody String productId);

    /**
     * 售后成功时商品库存回滚
     * @param shouhouProductDto
     * @return
     */
    @PostMapping("/saveProduct")
    boolean saveProduct(@RequestBody ShouhouProductDto shouhouProductDto);

    //lpx
    @PostMapping("/updateProductSales")
    ResponseData updateProductSales(@RequestBody ArrayList<ForOrderProductDTO> forOrderProductDTOS);

    //lpx
    @PostMapping("/updateCart")
    ResponseData updateCart(@RequestParam("userId") String userId, @RequestBody List<ForOrderProductDTO> products);
}
